package cli

import (
	"fmt"
	"github.com/spf13/cobra"
	"gofly/flyGin"
	gdaemon "gofly/utils/daemon"
	"io/ioutil"
	"os"
)

var serverCmd = &cobra.Command{
	Use:   "start",
	Short: "启动http服务",
	Run: func(cmd *cobra.Command, args []string) {
		if daemon {
			d := gdaemon.NewDaemon("")
			d.Run()
		}
		ioutil.WriteFile("gofly.sock", []byte(fmt.Sprintf("%d,%d", os.Getppid(), os.Getpid())), 0666)
		//allPath := utils.GetAllExecutePath()
		//log.Println(allPath)
		//gspt.SetProcTitle("gofly master:"+allPath)
		flyGin.NewFlyGin()
	},
}
